package com.leetcode.August;

import java.util.HashMap;

/**
 * @Description: 287. 寻找重复数
 * @Author: Mr.Fxy
 * @CreateTime: 2024-08-05 22:00
 */
public class LC287寻找重复数 {
    public int findDuplicate(int[] nums) {
        HashMap<Integer, Integer> objectObjectHashMap = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (objectObjectHashMap.containsKey(nums[i])) {
                return nums[i];
            } else {
                objectObjectHashMap.put(nums[i], 1);
            }
        }
        return 0;
    }
}
